//
//  ZDWalletLog.m
//  TCProject
//
//  Created by admin on 16/2/1.
//  Copyright © 2016年 wise-wing. All rights reserved.
//

#import "ZDWalletLog.h"

@implementation ZDWalletLog


- (instancetype)init
{
    if (self = [super init]) {
        if (!kRoleType) {
            _selected = YES;
        }
    }
    return self;
}

+ (NSDictionary *)objectClassInArray{
    return @{@"serviceLogs" : [ZDWalletLog class]};
}

- (void)setOperateDate:(NSString *)operateDate
{
    _operateDate = operateDate;
    
    //    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    //    formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss.fff";
    //    NSDate *date = [formatter dateFromString:_operateDate];
    //    formatter.dateFormat = @"MM月";
    //    self.name = [formatter stringFromDate:date];
    self.name = [NSString stringWithFormat:@"%@月", [_operateDate substringWithRange:NSMakeRange(5, 2)]];
}

- (double)realsumPrice
{
    if (_realsumPrice == 0) {
        double totalPrice = 0;
        for (ZDWalletLog *log in _serviceLogs) {
            totalPrice += log.realsumPrice;
        }
        return totalPrice;
    }
    return _realsumPrice;
}

@end
